Skip to content

fix(api): provide seed npcs.json fixture and safe file loader (#83) - #96

Open
Rodrigoue9 wants to merge 1 commit into
Bitcoindefi:mainfrom
Rodrigoue9:fix/bounty-83
Open

fix(api): provide seed npcs.json fixture and safe file loader (#83)#96
Rodrigoue9 wants to merge 1 commit into
Bitcoindefi:mainfrom
Rodrigoue9:fix/bounty-83

Conversation

@Rodrigoue9

Copy link
Copy Markdown

Title

fix(api): provide seed npcs.json fixture and safe file existence loader (#83)

Description

  • Adds baseline api/src/jsons/npcs.json seed data containing vendor and priest NPC presets.
  • Adds existence guard checks in loadSeedNpcsJson and loadNpcsJsonFromFile to avoid unhandled ENOENT exceptions during clean CI test runs.
  • Fixes market.integration.test.ts requirement for seeded trade NPCs.

Closes #83

@gitar-bot

gitar-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Adds baseline npcs.json seed data and safety checks to prevent ENOENT crashes during CI test runs. Consider making the silent empty-array fallback explicit to avoid masking missing seed files.

💡 Quality: Silent empty-array guard can mask missing seed data

📄 api/src/lib/gameData.ts:248-262

loadSeedNpcsJson/loadNpcsJsonFromFile now return [] when the file is absent instead of throwing ENOENT. This is fine for the CI fixture case, but at runtime it means a genuinely missing/unshipped npcs.json would silently leave game_npcs empty (seeding commits 0 rows) rather than failing loudly, making a deployment/packaging regression hard to detect. Consider logging a warning when the seed file is missing, or only swallowing the error in test environments so production misconfigurations still surface.

🤖 Prompt for agents
Code Review: Adds baseline npcs.json seed data and safety checks to prevent ENOENT crashes during CI test runs. Consider making the silent empty-array fallback explicit to avoid masking missing seed files.

1. 💡 Quality: Silent empty-array guard can mask missing seed data
   Files: api/src/lib/gameData.ts:248-262

   `loadSeedNpcsJson`/`loadNpcsJsonFromFile` now return `[]` when the file is absent instead of throwing ENOENT. This is fine for the CI fixture case, but at runtime it means a genuinely missing/unshipped `npcs.json` would silently leave `game_npcs` empty (seeding commits 0 rows) rather than failing loudly, making a deployment/packaging regression hard to detect. Consider logging a warning when the seed file is missing, or only swallowing the error in test environments so production misconfigurations still surface.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Falta api/src/jsons/npcs.json en el repositorio y el test de market no puede correr

1 participant